//
//  LSZViewController.m
//  PartyClassCloud
//
//  Created by 梁素珍 on 2018/8/13.
//  Copyright © 2018年 九酷. All rights reserved.
//

#import "LSZViewController.h"

@interface LSZViewController ()

@end

@implementation LSZViewController
-(void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    self.tabBarController.tabBar.hidden=YES;
}
- (void)viewDidAppear:(BOOL)animated {
    [super viewDidAppear:animated];
//    NSString *className = [NSString stringWithFormat:@"%@",[self topViewController].class];
//    NSString * strDelete = [NSString stringWithFormat:@"%@Login",className];
//    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(goToLogin) name:strDelete object:nil];//删除通知
}
-(void)goToLogin
{
    NSString *appDomain = [[NSBundle mainBundle] bundleIdentifier];
    [[NSUserDefaults standardUserDefaults] removePersistentDomainForName:appDomain];
    
    [_UserM setLeaf:NullStringjudgment(NSStr(@""))];
    [_UserM setId_id:NullStringjudgment(NSStr(@""))];
    [_UserM setName:NullStringjudgment(NSStr(@""))];
    [_UserM setSummary:NullStringjudgment(NSStr(@""))];
    [_MyCenter setRealName:@""];
    [_MyCenter setMobilePhone:@""];
    [_MyCenter setBranch_name:@""];
    [_MyCenter setBranch_id:@""];
    [_MyCenter setSex:@""];
    [_MyCenter setDepartmentScore:@""];
    [_MyCenter setHeadUrl:@""];
    UIWindow * window = [UIApplication sharedApplication].delegate.window;
    LSZPasswordLoginVC * vc = [[LSZPasswordLoginVC alloc]init];
    [window setRootViewController:vc];
}
- (UIViewController *)_topViewController:(UIViewController *)vc {
    if ([vc isKindOfClass:[UINavigationController class]]) {
        return [self _topViewController:[(UINavigationController *)vc topViewController]];
    } else if ([vc isKindOfClass:[UITabBarController class]]) {
        return [self _topViewController:[(UITabBarController *)vc selectedViewController]];
    } else {
        return vc;
    }
    return nil;
}
- (UIViewController *)topViewController {
    UIViewController *resultVC;
    resultVC = [self _topViewController:[[UIApplication sharedApplication].keyWindow rootViewController]];
    while (resultVC.presentedViewController) {
        resultVC = [self _topViewController:resultVC.presentedViewController];
    }
    return resultVC;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationController.navigationItem.hidesBackButton = YES;//隐藏系统的返回按钮
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"back_green"] style:UIBarButtonItemStyleDone target:self action:@selector(back)];
    
  self.navigationController.navigationBar.titleTextAttributes = @{NSForegroundColorAttributeName:[UIColor whiteColor],NSFontAttributeName:[UIFont boldSystemFontOfSize:22]};
    self.view.backgroundColor = RGBColor(236, 236, 236);

}
#pragma mark - 弹出警告框
-(void)initWithtring :(NSString *)string
{
    AlertKuangView * alert = [AlertKuangView new];
    [alert moveJingGaoKuang:string:self.view];
}
-(void)back{
    [self.navigationController popViewControllerAnimated:YES];
}


@end
